<?php

//import("ORG.Util.Page");

class TeachResAction extends Action{

	public function __construct(){
		parent::__construct();
		$sidebarItem = array();
		$sidebarItem['index'] = array('name'=>'教师一览','url'=>'__APP__/TeachRes/');
		$sidebarItem['tutors'] = array('name'=>'研究生导师','url'=>'__APP__/TeachRes/tutors');
		$sidebarItem['overSeasTeachers'] = array('name'=>'境外教师','url'=>'__APP__/TeachRes/overSeasTeachers');
		$sidebarItem['institude'] = array('name'=>'中科院软件研究所','url'=>'__APP__/TeachRes/institude');
		$sidebarItem['jindie'] = array('name'=>'金蝶创新班导师','url'=>'__APP__/TeachRes/jindie');
		if(ACTION_NAME != 'teacher'){
			$sidebarItem[ACTION_NAME]['selected'] = true;
		}
		$this->assign("sidebarItem",$sidebarItem);
	}

	//师资列表
	public function index(){

		$Teacher = new Model("Teacher");

		$professorList = $Teacher->where('type=0')->order('teacher_id')->select();	//教授
		$assProfessorList = $Teacher->where('type=1')->order('teacher_id')->select();	//副教授
		$lecturerList = $Teacher->where('type=2')->order('teacher_id')->select();	//教师或博士
		$schoolPTTeacherList = $Teacher->where('type=3')->order('teacher_id')->select();	//校内兼职教师
		$enterpriseTeacherList = $Teacher->where('type=4')->order('teacher_id')->select();	//企业聘请教师
		$overSeasTeacherList = $Teacher->where('type=5')->order('teacher_id')->select();	//主要境外教师

		$this->assign('professorList',$professorList);
		$this->assign('assProfessorList',$assProfessorList);
		$this->assign('lecturerList',$lecturerList);
		$this->assign('schoolPTTeacherList',$schoolPTTeacherList);
		$this->assign('enterpriseTeacherList',$enterpriseTeacherList);
		$this->assign('overSeasTeacherList',$overSeasTeacherList);

		$this->display();

    }


    //查看教师的具体个人信息
    public function teacher(){
    	$Teacher = new Model("Teacher");
    	$teacher_id = (int)$_GET['teacher_id'];
		$teacher = $Teacher->where('teacher_id='.$teacher_id)->find();

		$this->assign("teacher",$teacher);
		$this->display();
    }

    //研究生导师列表
    public function tutors(){
    	$Teacher = new Model("Teacher");
    	$masterTutors = $Teacher->where('tutorType=1')->order('teacher_id')->select();	//硕士生导师
    	$PhDTutors = $Teacher->where('tutorType=2')->order('teacher_id')->select();	//博士生导师

    	$this->assign('masterTutors',$masterTutors);
		$this->assign('PhDTutors',$PhDTutors);

		$this->display();
    }

    //境外教师列表
    public function overSeasTeachers(){

    	$Teacher = new Model("Teacher");
    	$TeacherList = $Teacher->where('type=5')->order('teacher_id')->select();	//主要境外教师
    	$this->assign('TeacherType',"主要境外教师");
    	$this->assign('TeacherList',$TeacherList);
		$this->display();
    }

    //中国软件研究所导师
    public function institude(){
    	$Teacher = new Model("Teacher");
    	$TeacherList = $Teacher->where('type=6')->order('teacher_id')->select();	//主要境外教师
    	$this->assign('TeacherType',"中国软件研究所导师");
    	$this->assign('TeacherList',$TeacherList);
		$this->display('teacherlist');
    }

    //金蝶研究所导师
    public function jindie(){
    	$Teacher = new Model("Teacher");
    	$TeacherList = $Teacher->where('type=6')->order('teacher_id')->select();	//主要境外教师
    	$this->assign('TeacherType',"金蝶研究所导师");
    	$this->assign('TeacherList',$TeacherList);
		$this->display('teacherlist');
    }
}
?>
